package com.iknight.mgr.core.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.Map;

/**
 * @param <T>
 * @author Jeryzym
 * @description 基准控制器
 */
public interface BaseController<T extends Serializable> {

    /**
     * @param params
     * @param request
     * @param response
     * @return
     * @description 保存方法
     */
    Object save(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);

    /**
     * @param params
     * @param request
     * @param response
     * @return
     * @description 删除方法
     */
    Object delete(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);

    /**
     * @param params
     * @param request
     * @param response
     * @return
     * @description 根据主键单条查询
     */
    Object selectOne(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);

    /**
     * @description 根据参数分页查询
     * @param params
     * @param request
     * @param response
     * @return
     */
    Object selectByPage(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);

    /**
     * @param params
     * @return 实体
     * @description 格式化数据
     */
    T format(Map<String, Object> params);

    /**
     * 判断主键是否存在
     *
     * @param params
     * @return
     */
    boolean isPKeyNotNull(Map<String, Object> params);
}
